home *** CD-ROM | disk | FTP | other *** search
- Path: linus.mitre.org!spectre!eachus
- From: eachus@spectre.mitre.org (Robert I. Eachus)
- Newsgroups: comp.lang.ada,comp.lang.c++
- Subject: Re: Iterators (was Re: some questions re. Ada/GNAT from a C++/GCC user)
- Date: 01 Apr 1996 20:38:13 GMT
- Organization: The Mitre Corp., Bedford, MA.
- Message-ID: <EACHUS.96Apr1153813@spectre.mitre.org>
- References: <wnewmanDoxrCp.DKv@netcom.com> <Dp1oAw.7Cz@world.std.com>
- <EACHUS.96Mar29191146@spectre.mitre.org> <4jlmn5$h1k@Nntp1.mcs.net>
- NNTP-Posting-Host: spectre.mitre.org
- In-reply-to: mikey@mcs.com's message of 31 Mar 1996 10:27:49 GMT
-
-
- In article <EACHUS.96Mar29191146@spectre.mitre.org>, I said:
-
- > The choice was between Ada and a shell script...I chose Ada.
-
- In article <4jlmn5$h1k@Nntp1.mcs.net> mikey@mcs.com (Mike Young) writes:
-
- > I don't know about that, Robert. The equivalent shell script would be...
-
- No, that would NOT be the equivalent shell script. Yes, that is
- similar to the approach I would have taken with a shell script, but
- the main difference is that the shell script would invoke a program
- once for each file, while the Ada approach allowed me to invoke a
- subprogram WITHIN a program once for each file name.
-
- Now the actual tasks the tools were doing were such that having a
- single program run 1000 times with state passed through (other) files
- would have resulted in O(N squared) preformance as the state files to
- be read in each time got larger and larger. Another path I considered
- was to use a script to catenate all files together--in a pipe, not a
- file--then write a separate program to take the pipe as input. In
- that case I lose the advantages of having the file name as "out of
- band" information. I'd have to prepend a structured comment to each
- file before piping it, and on the other end, look for the structured
- comments and process them.
-
- Also, I could have used a DBMS, but that would have required
- different DDL and SQL for each of several tools, where with the all
- Ada approach much of the code could be shared.
-
- So after doing a quick analysis, writing a file iterator--which
- took about two hours to write and debug--was by far the best solution.
- I posted the code because others may find it useful as well, even in
- cases where the "simple" shell script would work.
- --
-
- Robert I. Eachus
-
- with Standard_Disclaimer;
- use Standard_Disclaimer;
- function Message (Text: in Clever_Ideas) return Better_Ideas is...
-